from threading import Thread
import hashlib

# 用户传参
passwdlist = "./password.txt"
md5_code = "d7fa24ff29a9180e56bead5eb93fe712"


def md5_boom(passwd):
    md5_pwd = hashlib.md5(passwd.strip().encode()).hexdigest()
    if md5_pwd == md5_code:
        print(f"[+] MD5撞库成功, 加密源码为：{passwd.strip()}")
        exit()


def run():
    thread_list = []
    with open(file=passwdlist, mode="r", encoding="utf-8") as passwds:
        for passwd in passwds.readlines():
            t = Thread(target=md5_boom, args=(passwd.strip()))
            t.start()
            thread_list.append(t)
    for t in thread_list:
        t.join()


if __name__ == '__main__':
    run()
